//
//  MNDUserCenterCollectionCell.m
//  miniwangdai2
//
//  Created by Steven.Yung on 2017/3/28.
//  Copyright © 2017年 谭谭伟. All rights reserved.
//

#import "MNDUserCenterCollectionCell.h"

@interface MNDUserCenterCollectionCell ()

@property (nonatomic, strong) UILabel *cellTitleLabel;
@property (nonatomic, strong) UILabel *cellSubtitleLabel;
@property (nonatomic, strong) UIImageView *cellIcon;

@end

@implementation MNDUserCenterCollectionCell

- (instancetype)init {
    
    self = [super init];
    
    if (self) {
        [self initialUI];
    }
    
    return self;
}

- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    
    if (self) {
        [self initialUI];
    }
    
    return self;
}

- (void)initialUI {
    
    self.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.cellIcon];
    [self.contentView addSubview:self.cellTitleLabel];
    [self.contentView addSubview:self.cellSubtitleLabel];
    
//    [textContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerY.equalTo(self.contentView);
//        make.right.equalTo(self.contentView);
//        make.width.equalTo(self.contentView.mas_width).multipliedBy(2/3);
//        make.height.equalTo(self.contentView.mas_height).multipliedBy(1/3);
//    }];
    
    [self.cellTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.mas_bottom).multipliedBy(0.28);
//        make.left.equalTo(self.contentView).offset(50);
        make.left.equalTo(self.contentView.mas_right).multipliedBy(0.33);
        
    }];
    
    [self.cellSubtitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.cellTitleLabel);
        make.top.equalTo(self.cellTitleLabel.mas_bottom).offset(4.0);
    }];
    
    [self.cellIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.cellTitleLabel.mas_left).offset(-8.0);
        make.centerY.equalTo(self.cellTitleLabel);
    }];
}

- (void)configCellTitle:(NSString *)title subTitle:(NSString *)subtitle iconImage:(UIImage *)icon {
    self.cellTitleLabel.text = title;
    self.cellSubtitleLabel.text = subtitle;
    self.cellIcon.image = icon;
}

#pragma mark - Getter

- (UILabel *)cellTitleLabel {
    if (!_cellTitleLabel) {
        _cellTitleLabel = [[UILabel alloc] init];
        _cellTitleLabel.textColor = [UIColor colorWithHex:0x333333];
        _cellTitleLabel.font = [UIFont systemFontOfSize:16.0];
        _cellTitleLabel.text = @"自动投标";
//        _cellTitleLabel = label;
    }
    return _cellTitleLabel;
}

- (UILabel *)cellSubtitleLabel {
    if (!_cellSubtitleLabel) {
        _cellSubtitleLabel = [[UILabel alloc] init];
        _cellSubtitleLabel.textColor = [UIColor colorWithHex:0xa5a5a5];
        _cellSubtitleLabel.font = [UIFont systemFontOfSize:12.0];
        _cellSubtitleLabel.text = @"自动投标让资产无闲置";
//        _cellSubtitleLabel = label;
    }
    return _cellSubtitleLabel;
}

- (UIImageView *)cellIcon {
    if (!_cellIcon) {
        _cellIcon = [[UIImageView alloc] init];
        _cellIcon.image = [UIImage imageNamed:@"user_center_auto_tender"];
        
//        _cellIcon = imageView;
    }
    
    return _cellIcon;
}

@end
